package demo;

/**
 * t4
 */
public class TestEmployee {
    public static void main(String[] args) {
        Employee e=new SalesEmployee();
        System.out.println(e);
    }


}

class Employee{
    int id;
    String name;
    Double salary;

    Employee(){}

    public Employee(int id, String name,Double salary) {
        this.id = id;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getSalary() {
        return salary;
    }

    public void setSalary(Double salary) {
        this.salary = salary;
    }

    @Override
    public String toString() {
        return "Employee{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }

    int compareTo(Object o){
        if(o instanceof Employee){
            Employee o1=(Employee)o;
            return this.id-o1.getId();
        }
        return 0;
    }

}

class SalesEmployee extends Employee{
    private double proFit;

    @Override
    public String toString() {
        return "SalesEmployee{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", salary=" + salary +
                ", proFit=" + proFit +
                '}';
    }
}